// 手术申请
import React, { Component } from 'react';
import { Form, Row, Col, DatePicker, TimePicker, Table, Select, Input, Button, Divider, message, Radio, Checkbox, Tooltip } from 'antd';
import { $http } from '../../../containers/config/https';
import { Util } from 'tools/index';
import { $loadTemplate } from '../../lodop/Common/Print.js';
import moment from 'moment';
import FormItem from 'antd/lib/form/FormItem';
import TextArea from 'antd/lib/input/TextArea';
import ShowCommonTableModal from '../../workstation/component/ShowCommonTableModal.jsx'
import PublicModalQueryTable from 'pages/common/PublicModalQueryTable';
import './style/OperationApply.less';

// 用户数据
let userData;
// 点击编辑时记录当前行数据
let tableRecord = {};
//患者信息
let patientData;
var scrollCount = 0;
// 创建表单
const OperationApply = Form.create()(
	class extends Component {
		constructor(props) {
			super(props);
			userData = sessionStorage.userData ? JSON.parse(sessionStorage.userData) : {}
			patientData = JSON.parse(sessionStorage.getItem('patientData'))
			this.state = {
				operationApplyInfo: {},		// 手术申请信息
				patientData: patientData,
				operationLocData: [],		// 手术室下拉数据源
				defOperationLocID: '',
				operationRoomData: [],		// 手术间下拉数据源
				operationDocData: [],		// 主刀医师下拉数据源
				assistantDocData: [],		// 助手下拉数据源
				RHBloodTypeData: [],
				operationFrequencyData: [],	// 台次下拉数据源
				anesthesiaData: [],			// 麻醉下拉数据源
				operationData: [],			// 手术下拉数据源
				operationLevelData: [],		// 级别下拉数据源
				operationPartData: [],		// 手术部位下拉数据源
				operationCutData: [],		// 手术切口下拉数据源
				operationPostData: [],		// 手术体位下拉数据源
				bloodTpyeData: [],			// 血型下拉数据源
				classificationData: [],		// 手术分类下拉数据源
				projectTypeData: [],		// 手术项目类型下拉数据源
				motivationData: [],			// 手术动机下拉数据源
				surgicalPopulationData: [],  // 手术人群下拉数据
				triageAssociatedData: [],    // 分诊前台关联数据
				HbsAgTraitsData: [],
				defHbsAgTraitsID: '',
				HcvAbTraitsData: [],
				defHcvAbTraitsID: '',
				HivAbTraitsData: [],
				defHivAbTraitsID: '',
				syphilisTraitsData: [],
				defSyphilisTraitsID: '',
				defBloodTpyeID: '',
				defRHBloodTypeID: '',
				editingKey: '',				// 当前编辑的table数据
				removeOperation: [],		// 待删除数据
				disabledAll: (!patientData) || (patientData.admID === '') ? true : false,      //全局禁用
				tableData: [],
				newTabelData: [],
				locDesc: "0",
				acValue: "E",
				value: '',
				statusCode: '',				//当前手术状态
				operationPartPar: [],		//部位明细
				patOperationID: '',
				selectedOperationUser: [],	// 已选择的医护人员（下拉框禁用使用）
				diag: '',					// 诊断
				locType: '',				// 科室类型
				workDate: '',				// 上班日期(择期时判断)
				offWorkTime: '',			// 下班时间(选择时间时判断)
				EN: {},
				CN: {},
				page: 1,
				pageSize: 50,
				total: 0,
				current: 1,
				searchCode: '',
				selectIndex: 0,//当前选中行
				changename: '',
				dataSource: [],
				crystalsModelArr: [],		// 晶体型号
				crystalsStrengthArr: [],	// 晶体度数
				crystalsRepReasonArr: [],	// 晶体替换原因
				anaesthesiaDocaArr: [],		//麻醉医师数据集
				docECGDocArr: [],			//心电监护数据集
				leftEyeCrystalData: {},//左眼晶体数据
				rightEyeCrystalData: {},//右眼晶体数据
				leftEyeCrystalInventory: -1,//左眼晶体数量
				rightEyeCrystalInventory: -1,//右眼晶体数量
				columns: [],
				operationColumns: [],
				showInsuInfoFlag: 'N', // 是否展示医保信息
				hideCancelFlag: 'Y', // 隐藏取消手术按钮
				ordDateSubtract: '', // 医嘱日期禁用范围 - 前多少天可以选择
			}
			this.loadListener = this.keyDownElement.bind(this);
			this.columns = [{
				key: 1,
				title: () => this.display('OperationApplyseqNo'),
				dataIndex: 'seqNo',
				align: "center",
				width: '80px',
			}, {
				key: 2,
				title: () => this.display('OperationApplyopration'),
				dataIndex: 'operationDesc',
				align: "center",
				width: '300px',
				render: (text, record, index) => {
					const editable = this.isEditing(record);
					return (
						<Input
							allowClear={true}
							autoFocus
							onClick={this.handleStopPropagation}
							id={"operation-input" + index}
							value={record.operationDesc}
							onFocus={this.onDiagDescFocus.bind(this, index)}
							style={{ width: "100%", textAlign: "left" }}
							onChange={this.handleFieldChange.bind(this, index, 'operationDesc')}
							onPressEnter={this.getOperationData}
							disabled={editable ? false : true}
							autoComplete="off"
						/>
					)
				}

			}, {
				key: 6,
				title: () => this.display('OperationApplyclassification'),
				dataIndex: 'classification',
				align: "center",
				width: '100px',
				render: (text, record, index) => {
					const editable = this.isEditing(record);
					return (
						<Select
							value={record.classification}
							allowClear
							style={{ width: "100%", textAlign: "left" }}
							onChange={this.handleFieldChange.bind(this, index, 'classification')}
							disabled={editable ? false : true}
							showSearch
							optionFilterProp='role'
						>
							{this.state.classificationData.map(data => (
								<Select.Option
									role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}
									key={data.id}
								>
									{data.descripts}
								</Select.Option>))}
						</Select>
					)
				}
			}, {
				key: 7,
				title: () => this.display('OperationApplyprojectType'),
				dataIndex: 'projectType',
				align: "center",
				width: '100px',
				render: (text, record, index) => {
					const editable = this.isEditing(record);
					return (
						<Select
							value={record.projectType}
							allowClear
							style={{ width: "100%", textAlign: "left" }}
							onChange={this.handleFieldChange.bind(this, index, 'projectType')}
							disabled={editable ? false : true}
							showSearch
							optionFilterProp='role'
						>
							{this.state.projectTypeData.map(data => (
								<Select.Option
									role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}
									key={data.id}
								>
									{data.descripts}
								</Select.Option>))}
						</Select>
					)
				}
			}, {
				key: 3,
				title: () => this.display('OperationApplycategory'),
				dataIndex: 'categoryID',
				align: "center",
				width: '100px',
				render: (text, record, index) => {
					const editable = this.isEditing(record);
					return (
						<Select
							value={record.categoryID}
							allowClear
							style={{ width: "100%", textAlign: "left" }}
							onChange={this.handleFieldChange.bind(this, index, 'categoryID')}
							disabled={editable ? false : true}
							showSearch
							optionFilterProp='role'
						>
							{this.state.operationLevelData.map(data => (
								<Select.Option
									role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}
									key={data.id}
								>
									{data.descripts}
								</Select.Option>))}
						</Select>
					)
				}
			}, {
				key: 4,
				title: () => this.display('OperationApplyoperationPart'),
				dataIndex: 'operationPart',
				align: "center",
				width: '100px',
				render: (text, record, index) => {
					const editable = this.isEditing(record);
					return (
						<Select
							mode="multiple"
							value={record.operationPart ? record.operationPart : ''}
							allowClear
							style={{ width: "100%", textAlign: "left" }}
							onChange={this.handleFieldChange.bind(this, index, 'operationPart')}
							disabled={editable ? false : true}
							showSearch
							optionFilterProp='role'
						>
							{this.state.operationPartData.map(data => (
								<Select.Option
									role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}
									key={data.id}
								>
									{data.descripts}
								</Select.Option>))}
						</Select>
					)
				}
			}, {
				key: 5,
				title: () => this.display('OperationApplyincision'),
				dataIndex: 'incisionID',
				align: "center",
				width: '100px',
				render: (text, record, index) => {
					const editable = this.isEditing(record);
					return (
						<Select
							value={record.incisionID}
							allowClear
							style={{ width: "100%", textAlign: "left" }}
							onChange={this.handleFieldChange.bind(this, index, 'incisionID')}
							disabled={editable ? false : true}
							showSearch
							optionFilterProp='role'
						>
							{this.state.operationCutData.map(data => (
								<Select.Option
									role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}
									key={data.id}
								>
									{data.descripts}
								</Select.Option>))}
						</Select>
					)
				}
			}, {
				// 	key: 8,
				// 	title: () => this.display('OperationApplymotivation'),
				// 	dataIndex: 'motivation',
				// 	align: "center",
				// 	width: '10%',
				// 	render: (text, record, index) => {
				// 		const editable = this.isEditing(record);
				// 		return (
				// 			<Select
				// 				value={record.motivation}
				// 				allowClear
				// 				style={{ width: "100%", textAlign: "left" }}
				// 				onChange={this.handleFieldChange.bind(this, index, 'motivation')}
				// 				disabled={editable ? false : true}
				// 				showSearch
				// 				optionFilterProp='role'
				// 			>
				// 				{this.state.motivationData.map(data => (
				// 					<Select.Option
				// 						role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}
				// 						key={data.id}
				// 					>
				// 						{data.descripts}
				// 					</Select.Option>))}
				// 			</Select>
				// 		)
				// 	}
				// }, {
				key: 9,
				title: () => this.display('OperationApplysurgicalRremarks'),
				dataIndex: 'notes',
				align: "center",
				width: '150px',
				render: (text, record, index) => {
					const editable = this.isEditing(record);
					return (
						<Input
							onClick={this.handleStopPropagation}
							value={record.notes}
							style={{ width: "100%", textAlign: "left" }}
							onChange={this.handleFieldChange.bind(this, index, 'notes')}
							disabled={editable ? false : true}
						/>
					)
				}
			}];
			this.operationColumns = [{
				title: () => this.display('OperationApplyICDCode'),
				dataIndex: 'ICDCode',
				width: 80,
				align: 'left',
			}, {
				title: () => this.display('OperationApplydescripts'),
				dataIndex: 'descripts',
				width: 200,
				align: 'left',
			}, {
				title: () => this.display('OperationApplycategoryDesc'),
				dataIndex: 'categoryDesc',
				width: 200,
				align: 'left',
			}]
		}

		componentDidMount() {
			this.languageSwitch();
			this.getSelectData();
			this.loadPatientMsg(); //获取接诊病人信息
			this.getCrystalsStrength();
			this.loadDateTime(); // 获取手术日期
			if ((!this.state.patientData) || (this.state.patientData.admID == '')) {
				// message.warning('请选择患者');
				this.setState({
					disabledAll: true,
				})
			}
			this.loadPatDiagData();
			if (this.props.operationID) this.getOperationProjType('');
		}

		//手术日期
		loadDateTime() {
			let data = {
				params: [{
					locID: userData.locID
				}]
			}
			$http.post('urlS', this, {
				code: "04160027",
				data: data,
				success: function (res) {
					if (res.errorCode == '0') {
						let defaultData = res?.defalutData || {};
						let ordDate = defaultData?.ordDate ? moment(defaultData?.ordDate, 'YYYY-MM-DD') : moment();
						let ordTime = defaultData?.ordTime ? moment(defaultData?.ordTime, 'HH:mm') : moment();
						if (!Util.isEmpty(res.result)) {
							this.props.form.setFieldsValue({
								operationDate: moment(moment(res.result), 'YYYY-MM-DD'),
								ordDate,
								ordTime
							})
						}
						this.setState({
							operationDate: res.result ? moment(res.result).format('YYYY-MM-DD') : ''
						})
					}
				}
			});
		}

		// 获取手术项目类型
		getOperationProjType = (classID) => {
			let data = {
				params: [{
					classID
				}]
			}
			$http.post('urlS', this, {
				code: "04160025",
				data: data,
				success: function (res) {
					if (+res.errorCode === 0) {
						this.setState({
							projectTypeData: res.result
						})
					}
				}
			});
		}

		// 获取晶体型号
		getCrystalsModel = (defOperationLocID = '') => {
			let data = {
				params: [{
					opLocID: defOperationLocID, // 手术室
					medSubCatCode: '晶体'
				}]
			}
			$http.post('urlS', this, {
				code: "04160028",
				data: data,
				success: function (res) {
					if (+res.errorCode === 0) {
						this.setState({
							crystalsModelArr: res.result.Data
						})
					}
				}
			});
		}

		// 获取晶体度数
		getCrystalsStrength = () => {
			let data = {
				params: [{}]
			}
			$http.post('urlS', this, {
				code: "02060193",
				data: data,
				success: function (res) {
					if (+res.errorCode === 0) {
						this.setState({
							crystalsStrengthArr: res.result.degreesList
						})
					}
				}
			});
		}

		keyDownElement(e) {
			if (this.state.visible) {
				if (e.keyCode == '13') {
					this.setState({
						newIndex: 0
					})
				}
			}
		}

		componentWillReceiveProps(nextProps) {
			if (nextProps.hasOwnProperty('operationID') && (nextProps.operationID !== this.state.patOperationID)) {
				this.setState({
					patOperationID: nextProps.operationID
				}, () => {
					this.getInfo();
				})
			}
		}

		loadPatientMsg() {
			patientData = JSON.parse(sessionStorage.getItem('patientData'))
			if (!patientData || patientData.admID == '') {
				return;
			}
			var params = {
				params: [{
					admID: patientData.admID ? patientData.admID : '',
					userID: userData.userID
				}]
			}
			$http.post('urlDeault', this, {
				code: "04020007",
				data: params,
				success: function (res) {
					//	console.log(res)
					if (res.errorCode == '0') {
						sessionStorage.setItem('titleData', JSON.stringify(res.result))
						this.setState({
							titleData: res.result,
						})
					}
				}
			});
		}

		// 打印手术通知单
		print = () => {
			const { patOperationID } = this.state;
			let data = {};
			data = {
				params: [{
					patOperationID
				}]
			}
			let templateCode = 'SurgeryRF';
			$http.post('urlS', this, {
				code: '04160009',
				data: data,
				success: function (res) {
					if (res.errorCode === '0') {
						//加载模板
						$loadTemplate(templateCode, res.result);
					}
				}
			})
		}

		// 中英文切换
		languageSwitch = () => {
			let data = {
				params: [{
					reactCode: ['OperationApply']
				}]
			}
			$http.post('urlS', this, {
				code: '01040073',
				data: data,
				success: function (res) {
					if (+res.errorCode === 0) {
						this.setState({
							EN: res.result.language.EN,
							CN: res.result.language.CN
						})
					}
				}
			})
		}

		display(name) {
			return userData.language != 'EN' ? (this.state.CN[name] && this.state.CN[name]['descripts'] ? this.state.CN[name]['descripts'] : '') : (this.state.CN[name] && this.state.EN[name]['descripts'] ? this.state.EN[name]['descripts'] : '')
		}

		// 阻止默认事件
		handleStopPropagation = (e) => {
			if (typeof e == 'object') {
				e.stopPropagation();
			}
		}

		//加载本次诊断 
		loadPatDiagData() {
			let params = {
				params: [{
					admID: ((this.state.patientData) && (this.state.patientData.admID != '')) ? this.state.patientData.admID : '',
					patID: ((this.state.patientData) && (this.state.patientData.patID != '')) ? this.state.patientData.patID : '',
					historyType: "",
					historyFlag: "N",
				}]
			}
			$http.post('urlDeault', this, {
				code: "03050033",
				data: params,
				success: function (res) {
					if (res.errorCode == '0') {
						let diagList = res.result.diagList;
						let diagStr = '';
						for (let i = 0; i < diagList.length; i++) {
							if (!diagStr) {
								diagStr = `${(i + 1)}.${diagList[i]['diagDesc']};`
							} else {
								diagStr = `${diagStr} \n${(i + 1)}.${diagList[i]['diagDesc']};`
							}
						}
						this.setState({ diag: diagStr })
					}
				}
			});
		}

		// 获取手术下拉框数据
		getOperationData = (e) => {
			let searchCode = e.target ? e.target.value : this.state.searchCode
			if (searchCode != '') {
				this.setState({
					searchCode: searchCode,
				})
			}
			let data = {
				params: [{
					admID: (this.state.patientData && this.state.patientData.admID) ? this.state.patientData.admID : '',
					searchCode: searchCode ? searchCode : this.state.searchCode
				}],
				pagination: [{
					pageSize: this.state.pageSize,
					currentPage: this.state.page
				}]
			};
			$http.post('urlDeault', this, {
				code: "04160003",
				data: data,
				success: function (res) {
					if (+res.errorCode === 0) {
						let rowMedID = "";
						if ((res.result.Data) && (res.result.Data.length > 0)) {
							rowMedID = res.result.Data[0].id
						}
						this.setState({
							rowMedID: rowMedID,
							operationData: res.result.Data,
							total: res.result.TotalCount,
						}, () => this.child.showModal())
					}
				},
				error: function (error) {
					message.error('失败：' + error);
				}
			});
		}

		changeOperationLoc = (val, opt) => {
			if (val != undefined) {
				this.setState({
					value: val,
					workDate: opt.props.workDate,
					offWorkTime: opt.props.offWorkTime
				}, () => {
					this.props.form.setFieldsValue({
						operationRoomID: '',
						crystalsModelID: undefined, // 左眼晶体型号
						rcrystalsModelID: undefined, // 右眼晶体型号
						operationDate: this.state.workDate && this.props.form.getFieldsValue().type == 'E' ? moment(this.state.workDate, 'YYYY-MM-DD') : moment(moment(), 'YYYY-MM-DD')
					})
					this.getOperationRoomData(val);
					this.getCrystalsModel(val);
				});
			} else {
				this.props.form.setFieldsValue({
					operationRoomID: '',
					crystalsModelID: undefined,
					rcrystalsModelID: undefined,
					operationDate: this.state.workDate && this.props.form.getFieldsValue().type == 'E' ? moment(this.state.workDate, 'YYYY-MM-DD') : moment(moment(), 'YYYY-MM-DD')
				})
				this.getOperationRoomData('');
				this.getCrystalsModel('');
			}
		};

		//类型
		changeType = (e) => {
			this.setState({
				acValue: e.target.value,
			});
			if (e.target.value === 'E') {
				this.props.form.setFieldsValue({ operationDate: moment(this.state.workDate ? this.state.workDate : moment().add(1, 'day'), 'YYYY-MM-DD') })
			} else {
				this.props.form.setFieldsValue({ operationDate: moment(moment(), 'YYYY-MM-DD') })
			}
		};

		// 获取手术间下拉框数据
		getOperationRoomData = (value, isDefault) => {
			let data = {
				"params": [{
					locID: value
				}]
			};
			$http.post('urlDeault', this, {
				code: "04160005",
				data: data,
				success: function (res) {
					if (+res.errorCode === 0) {
						this.setState({
							operationRoomData: res.result
						}, () => {
							if (res.result.length > 0 && isDefault !== 'N') {
								this.props.form.setFieldsValue({ operationRoomID: res.result[0].id })
							}
						})
					}
				},
				error: function (error) {
					message.error('失败：' + error);
				}
			});
		}

		// 获取下拉框数据
		getSelectData = () => {
			let data = {
				"params": [{
					hospID: userData && userData.hospID ? userData.hospID : '', // 登录医院id       
					locID: userData.locID,
					admID: (this.state.patientData && this.state.patientData.admID) ? this.state.patientData.admID : '',
					patID: (this.state.patientData && this.state.patientData.patID) ? this.state.patientData.patID : '',
				}]
			};
			$http.post('urlDeault', this, {
				code: "04160001",
				data: data,
				success: function (res) {
					if (+res.errorCode === 0) {
						this.setState({
							locType: res.locType,
							operationLocData: res.locType != 'OP' ? res.OPLocArr : res.locArr,
							defOperationLocID: res.locType != 'OP' ? res.defOperationLocID : '',
							bloodTpyeData: res.BloodGroup.data,
							defBloodTpyeID: res.BloodGroup.defID,
							operationDocData: res.DoctorArr,
							assistantDocData: res.NurseArr,
							HbsAgTraitsData: res.HbsAgTraits.data,
							defHbsAgTraitsID: res.HbsAgTraits.defID,
							HcvAbTraitsData: res.HcvAbTraits.data,
							defHcvAbTraitsID: res.HcvAbTraits.defID,
							HivAbTraitsData: res.HivAbTraits.data,
							defHivAbTraitsID: res.HivAbTraits.defID,
							syphilisTraitsData: res.SyphilisTraits.data,
							defSyphilisTraitsID: res.SyphilisTraits.defID,
							RHBloodTypeData: res.RHBloodGroup.data,
							defRHBloodTypeID: res.RHBloodGroup.defID,
							operationPostData: res.OperationPosition,
							operationCutData: res.IncisionType,
							operationPartData: res.OperationPart,
							operationLevelData: res.OperationCategory,
							anesthesiaData: res.anesthesiaMode,
							classificationData: res.operationClass,
							motivationData: res.operationMotivation.data,
							surgicalPopulationData: res.surgicalPopulationData,
							crystalsRepReasonArr: res.crystalsRepReasonArr,
							anaesthesiaDocaArr: res.anaesthesiaDocaArr,
							docECGDocArr: res.docECGDocArr,
							triageAssociatedData: res.triageAssociatedData,
							showInsuInfoFlag: res?.showInsuInfoFlag || 'N',
							hideCancelFlag: res?.hideCancelFlag || 'Y', // 隐藏取消手术按钮
							ordDateSubtract: res?.ordDateSubtract || '', // 医嘱日期禁用范围 - 前多少天可以选择
						}, () => {
							this.getOperationColumns();
							if (this.state.patOperationID == '') {
								this.getLocDocConfigInfo();
							} else {
								this.obtainDataBasedOnDepartment();
							}
						})
					}
				},
				error: function (error) {
					message.error('失败：' + error);
				}
			});
		}

		// 表格下拉框选中
		handleFieldChange = (index, code, value, opt) => {
			let top = document.getElementById("operation-input" + index).getBoundingClientRect().top + 40
			let left = document.getElementById("operation-input" + index).getBoundingClientRect().left;
			let windowHeight = window.innerHeight;
			if ((top + 360) > windowHeight) {
				top = top - 330 - 80;
			}
			top = top + "px";
			left = left + "px";
			let { tableData, operationPartPar, projectTypeData } = this.state;
			if (value !== undefined) {
				if (code === 'operationPart') {
					operationPartPar = [];
					for (var key in value) {
						operationPartPar.push(value[key])
					}
					tableData[index].operationPart = operationPartPar;
				}
				else if (code === 'notes') {
					if (value.target.value.length > 50) {
						message.warning('备注超长');
						return;
					}
					tableData[index][code] = (typeof (value) == 'string') ? value : value.target.value;
				}
				else if (code == 'classification') {
					tableData[index].projectType = ''
					this.getOperationProjType(value)
					tableData[index][code] = (typeof (value) == 'string') ? value : value.target.value;
				}
				else {
					tableData[index][code] = (typeof (value) == 'string') ? value : value.target.value;
				}
			} else {
				tableData[index][code] = '';
				if (code == 'classification') {
					tableData[index].projectType = ''
					projectTypeData = []
				}
			}
			this.setState({
				tableData,
				operationPartPar,
				projectTypeData,
				top: top,
				left: left,
			})
		}

		isEditing = (record) => {
			return record.key === this.state.editingKey
		};

		// 确认手术
		handleUpdate = (record, e) => {
			e.preventDefault();
			// 未选择手术时提示
			if (record.operationID === '') {
				message.warning(this.display('OperationApplyselectOperation'));
				return;
			}
			// 未选择手术时提示
			if (record.categoryID === '') {
				message.warning(this.display('OperationApplyselectLevel'));
				return;
			}
			// 未选择手术时提示
			if (record.operationPart.length < 1) {
				message.warning(this.display('OperationApplyselectPart'));
				return;
			}
			// 未选择手术时提示
			if (record.incisionID === '') {
				message.warning(this.display('OperationApplyselectIncision'));
				return;
			}
			this.setState({
				editingKey: ''
			});
		}

		// 删除手术
		handleDelete = (record, e) => {
			e.preventDefault();
			let { tableData, removeOperation } = this.state;
			tableData.splice(record.key, 1);
			// 重新修改数据key/seqNo
			for (let i = 0; i < tableData.length; i++) {
				tableData[i].key = i;
				tableData[i].seqNo = i + 1;
			}
			if (record.opItemID !== '') {
				removeOperation.push(record.opItemID);
				removeOperation = [...removeOperation];
			}
			this.setState({
				tableData: tableData,
				removeOperation,
			})
		}

		// 编辑手术
		handleEdit = (record, e) => {
			e.preventDefault();
			tableRecord = JSON.parse(JSON.stringify(record));
			this.setState({
				editingKey: record.key
			}, () => this.getOperationProjType(record.classification));
		}

		// 取消编辑
		handleCancel = (record, e) => {
			e.preventDefault();
			let tableData = this.state.tableData;
			tableData[record.key] = tableRecord;
			this.getOperationProjType(tableRecord.classification)
			this.setState({ editingKey: '', tableData });//取消编辑
			return false;

			// if (record.opItemID !== '' && record.opItemID !== undefined) {
			// } else {
			// 	this.handleDelete(record, e);
			// }
		}

		// 复选框
		checkboxOnchange = (code) => {
			let { operationApplyInfo } = this.state
			operationApplyInfo[code] = operationApplyInfo[code] === 'Y' ? 'N' : 'Y'
			this.setState({
				operationApplyInfo: operationApplyInfo
			})
		}

		// 添加行
		addRow = () => {
			const { tableData } = this.state;
			if ((tableData.length > 0) && (tableData[tableData.length - 1]) && (tableData[tableData.length - 1]['operationID'] === '')) {
				message.warning('请先选择上一条记录的科手术');
				return;
			}
			let newData = tableData.map((item) => ({ ...item }));
			// 重新修改数据key
			for (let i = 0; i < newData.length; i++) {
				newData[i].key = i
				newData[i].seqNo = i + 1
			}
			tableRecord = {
				key: newData.length,
				seqNo: tableData.length + 1,
				operationDesc: '',
				operationID: '',
				categoryID: '',
				operationPart: [],
				incisionID: '',
				notes: '',
				classification: '',
				projectType: '',
				motivation: '',
				editable: true
			}
			newData.push(tableRecord);
			this.setState({
				tableRecord: tableRecord,
				tableData: newData,
				editingKey: newData.length - 1
			});
		}

		// 获取科室医生手术配置
		getLocDocConfigInfo = () => {
			let data = {
				params: [{
					operationConfigID: this.state.operationConfigID
				}]
			};
			$http.post('urlDeault', this, {
				code: "04160036",
				data: data,
				success: function (res) {
					if (+res.errorCode === 0) {
						if (!Util.isEmpty(res.result.Data)) {
							let dataInfo = res.result.Data[0];
							this.handleHistoryConfigOk(dataInfo);
							this.getOperationProjType('');
						} else {
							this.obtainDataBasedOnDepartment();
						}
					}
				},
				error: function (error) {
					message.error('失败：' + error);
					this.obtainDataBasedOnDepartment();
				}
			});
		}

		// 根据默认科室获取相关数据
		obtainDataBasedOnDepartment = () => {
			let { defOperationLocID, operationApplyInfo, triageAssociatedData } = this.state;
			if (defOperationLocID) {
				this.getOperationRoomData(defOperationLocID);
				this.getCrystalsModel(defOperationLocID); // 获取晶体型号
				const formData = this.props.form.getFieldsValue();
				triageAssociatedData && Array.isArray(triageAssociatedData) && triageAssociatedData.map((item => {
					if (item.code == 'OperPop' && !formData.surgicalPopulation) {
						operationApplyInfo.surgicalPopulation = item.value;
						this.props.form.setFieldsValue({ surgicalPopulation: item.value });
					}
					else if (item.code == 'Motivation' && !formData.motivation) {
						operationApplyInfo.motivation = item.value;
						this.props.form.setFieldsValue({ motivation: item.value });
					}
				}));
				this.setState({ operationApplyInfo: operationApplyInfo });
			}
		}

		// 获取手术单查询
		getInfo = () => {
			if (this.state.patOperationID == '' && this.props.operationID && this.props.operationID == '') return
			if (typeof (this.props.parentVisible) != "undefined")
				if (!this.props.parentVisible)
					return;
			let data = {
				params: [{
					patOperationID: this.state.patOperationID ? this.state.patOperationID : this.props.operationID,
				}]
			};
			$http.post('urlDeault', this, {
				code: "04160006",
				data: data,
				success: function (res) {
					if (+res.errorCode === 0) {
						let dataInfo = res.result.Data[0];
						this.getOperationRoomData(dataInfo.operationLocID);
						this.getCrystalsModel(dataInfo.operationLocID);
						this.setState({
							operationApplyInfo: dataInfo,
							tableData: dataInfo.operationDetail,
							statusCode: dataInfo.statusCode
						}, () => {
							this.props.form.setFieldsValue({
								operationRoomID: dataInfo.operationRoomID,
								operationDate: dataInfo.operationDate ? moment(dataInfo.operationDate, 'YYYY-MM-DD') : null,
								operationTime: dataInfo.operationTime ? moment(dataInfo.operationTime, 'HH:mm') : null,
								operationLocID: dataInfo.operationLocID ? dataInfo.operationLocID : '',
								duration: dataInfo.duration ? dataInfo.duration : '',
								applyNumber: dataInfo.applyNumber ? dataInfo.applyNumber : '',
								operatingSurgeon: dataInfo.operatingSurgeon ? dataInfo.operatingSurgeon : '',
								firstAssistant: dataInfo.firstAssistant ? dataInfo.firstAssistant : '',
								secondAssistant: dataInfo.secondAssistant ? dataInfo.secondAssistant : '',
								thirdAssistant: dataInfo.thirdAssistant ? dataInfo.thirdAssistant : '',
								otherAssistant: dataInfo.otherAssistant ? dataInfo.otherAssistant : '',
								anaesthesiaID: dataInfo.anaesthesiaID ? dataInfo.anaesthesiaID : '',
								anaesthesiaDoctorID: dataInfo.anaesthesiaDoctorID ? dataInfo.anaesthesiaDoctorID : '',
								ecgDoctorID: dataInfo.ecgDoctorID ? dataInfo.ecgDoctorID : '',
								applyDocNotes: dataInfo.applyDocNotes ? dataInfo.applyDocNotes : '',

								motivation: dataInfo.Motive ? dataInfo.Motive : '',
								surgicalPopulation: dataInfo.CrowdDr ? dataInfo.CrowdDr : '',

								specialEquipment: dataInfo.specialEquipment ? dataInfo.specialEquipment : '',
								positionID: dataInfo.positionID ? dataInfo.positionID : '',
								bloodType: dataInfo.bloodType ? dataInfo.bloodType : '',
								RHBlood: dataInfo.RHBlood ? dataInfo.RHBlood : '',
								HbsAg: dataInfo.HbsAg ? dataInfo.HbsAg : '',
								HcvAb: dataInfo.HcvAb ? dataInfo.HcvAb : '',
								HivAb: dataInfo.HivAb ? dataInfo.HivAb : '',
								syphilis: dataInfo.syphilis ? dataInfo.syphilis : '',
								notes: dataInfo.notes ? dataInfo.notes : '',
								crystalsModelID: dataInfo.crystalsModelID ? dataInfo.crystalsModelID : '',
								crystalsStrengthID: dataInfo.crystalsStrengthID ? dataInfo.crystalsStrengthID : '',
								crystalsNum: dataInfo.crystalsNum ? dataInfo.crystalsNum : '1',
								crystalsRepReasonID: dataInfo.crystalsRepReasonID ? dataInfo.crystalsRepReasonID : '',
								rcrystalsModelID: dataInfo.rcrystalsModelID ? dataInfo.rcrystalsModelID : '',
								rcrystalsStrengthID: dataInfo.rcrystalsStrengthID ? dataInfo.rcrystalsStrengthID : '',
								rcrystalsNum: dataInfo.rcrystalsNum ? dataInfo.rcrystalsNum : '1',
								rcrystalsRepReasonID: dataInfo.rcrystalsRepReasonID ? dataInfo.rcrystalsRepReasonID : '',
								rastigmatism: dataInfo.rastigmatism ? dataInfo.rastigmatism : '',
								astigmatism: dataInfo.astigmatism ? dataInfo.astigmatism : '',
								ordDate: dataInfo.ordDate ? moment(dataInfo.ordDate, 'YYYY-MM-DD') : moment(), // 医嘱开始日期
								ordTime: dataInfo.ordTime ? moment(dataInfo.ordTime, 'HH:mm') : moment(), // 医嘱开始时间
							})
						})
					}
				},
				error: function (error) {
					message.error('失败：' + error);
				}
			});
		}

		//保存
		save = (code) => {
			let { acValue } = this.state;
			if (code === '09') {
				let tableCount = this.state.tableData.length
				for (let i = 0; i < tableCount; i++) {
					if (this.state.tableData[i].operationID === '') {
						message.error('第' + (Number(i) + 1) + '行，手术没有选择!');
						return;
					}
				}
			}
			this.setState({
				clickFlag: true,
				editingKey: '',
			});
			const formData = this.props.form.getFieldsValue();
			this.props.form.validateFields((err, value) => {
				if (err) {
					this.setState({
						clickFlag: false,
						disabledAll: false
					}, () => {
						message.warning('存在必填项未填写')
					});
				} else {
					let data = {
						params: code === '09' || code === '' ? [{
							applyLocID: userData.applyLocID,
							applyDocID: userData.applyDocID,
							id: this.state.patOperationID ? this.state.patOperationID : '',
							admID: !Util.isEmpty(this.state.patientData.admID) ? this.state.patientData.admID : '',
							operationDate: formData.operationDate ? moment(formData.operationDate).format('YYYY-MM-DD') : '',
							operationTime: formData.operationTime ? moment(formData.operationTime).format('HH:mm') : '',
							operationLocID: formData.operationLocID ? formData.operationLocID : '',
							operationRoomID: formData.operationRoomID ? formData.operationRoomID : '',
							duration: formData.duration ? formData.duration : '',
							applyNumber: formData.applyNumber ? formData.applyNumber : '',
							operatingSurgeon: formData.operatingSurgeon ? formData.operatingSurgeon : '',
							firstAssistant: formData.firstAssistant ? formData.firstAssistant : '',
							secondAssistant: formData.secondAssistant ? formData.secondAssistant : '',
							thirdAssistant: formData.thirdAssistant ? formData.thirdAssistant : '',
							otherAssistant: formData.otherAssistant ? formData.otherAssistant : '',
							anaesthesiaID: formData.anaesthesiaID ? formData.anaesthesiaID : '',
							anaesthesiaDoctorID: formData.anaesthesiaDoctorID ? formData.anaesthesiaDoctorID : '',
							ecgDoctorID: formData.ecgDoctorID ? formData.ecgDoctorID : '',
							applyDocNotes: formData.applyDocNotes ? formData.applyDocNotes : '',

							Motive: formData.motivation ? formData.motivation : '',
							CrowdDr: formData.surgicalPopulation ? formData.surgicalPopulation : '',

							type: acValue ? acValue : '',
							specialEquipment: formData.specialEquipment ? formData.specialEquipment : '',
							positionID: formData.positionID ? formData.positionID : '',
							quarantine: this.state.operationApplyInfo.quarantine === 'Y' ? 'Y' : 'N',
							CPB: this.state.operationApplyInfo.CPB === 'Y' ? 'Y' : 'N',
							selfBloodRtn: this.state.operationApplyInfo.selfBloodRtn === 'Y' ? 'Y' : 'N',
							bloodPrepare: this.state.operationApplyInfo.bloodPrepare === 'Y' ? 'Y' : 'N',
							frozen: this.state.operationApplyInfo.frozen === 'Y' ? 'Y' : 'N',
							ecg: this.state.operationApplyInfo.ecg === 'Y' ? 'Y' : 'N',
							bloodType: formData.bloodType ? formData.bloodType : '',
							RHBlood: formData.RHBlood ? formData.RHBlood : '',
							HbsAg: formData.HbsAg ? formData.HbsAg : '',
							HcvAb: formData.HcvAb ? formData.HcvAb : '',
							HivAb: formData.HivAb ? formData.HivAb : '',
							syphilis: formData.syphilis ? formData.syphilis : '',
							notes: formData.notes ? formData.notes : '',
							statusCode: code,
							operationDetail: this.state.tableData,
							removeDetail: this.state.removeOperation,
							crystalsModelID: formData.crystalsModelID ? formData.crystalsModelID : '',
							crystalsStrengthID: formData.crystalsStrengthID ? formData.crystalsStrengthID : '',
							crystalsNum: formData.crystalsNum ? formData.crystalsNum : '1',
							crystalsRepReasonID: formData.crystalsRepReasonID ? formData.crystalsRepReasonID : '',
							rcrystalsModelID: formData.rcrystalsModelID ? formData.rcrystalsModelID : '',
							rcrystalsStrengthID: formData.rcrystalsStrengthID ? formData.rcrystalsStrengthID : '',
							rcrystalsNum: formData.rcrystalsNum ? formData.rcrystalsNum : '1',
							rcrystalsRepReasonID: formData.rcrystalsRepReasonID ? formData.rcrystalsRepReasonID : '',
							astigmatism: formData.astigmatism ? formData.astigmatism : '',
							rastigmatism: formData.rastigmatism ? formData.rastigmatism : '',
							ordDate: formData.ordDate ? moment(formData.ordDate).format('YYYY-MM-DD') : '', // 医嘱开始日期
							ordTime: formData.ordTime ? moment(formData.ordTime).format('HH:mm') : '', // 医嘱开始时间
						}] :
							[{
								admID: !Util.isEmpty(this.state.patientData.admID) ? this.state.patientData.admID : '',
								id: this.state.patOperationID ? this.state.patOperationID : '',
								statusCode: code,
								ordDate: formData.ordDate ? moment(formData.ordDate).format('YYYY-MM-DD') : '', // 医嘱开始日期
								ordTime: formData.ordTime ? moment(formData.ordTime).format('HH:mm') : '', // 医嘱开始时间
							}]
					};
					$http.post('urlADS', this, {
						code: "04160004",
						data: data,
						success: function (res) {
							if (+res.errorCode == '0') {
								message.success('成功');
								this.setState({
									clickFlag: false,
									patOperationID: res.id,
									statusCode: res.statusCode
								}, () => {
									if (code === '10')
										this.clearUIData();
									else
										this.getInfo();
								});
								if (code === '' && this.props && this.props.close) {
									//this.props.close()
								}
							} else {
								this.setState({ clickFlag: false, disabledAll: false })
							}
						},
						error: function (error) {
							message.error('失败：' + error);
							this.setState({ clickFlag: false, disabledAll: false })
						}
					});
					// if (code === '01') this.print()
				}
			});
		}

		// 下班后时间禁用
		getDisabledHours = () => {
			let hours = []
			let time = this.state.offWorkTime
			let timeArr = time.split(':')
			for (let i = 0; i < 24; i++) {
				if (i > parseInt(timeArr[0])) hours.push(i)
			}
			return hours
		}

		getDisabledMinutes = (selectedHour) => {
			let time = this.state.offWorkTime
			let timeArr = time.split(':')
			let minutes = []
			if (selectedHour == parseInt(timeArr[0])) {
				for (let i = 0; i < 60; i++) {
					if (i > timeArr[1]) minutes.push(i);
				}
			}
			return minutes
		}

		// 手术基础数据弹框
		onRef = (ref) => {
			this.child = ref;
		}

		//分页切换
		changePageSize(current, pageSize) {
			if ((pageSize == this.state.pageSize) && (current == this.state.page)) {
				if (this.state.rowMedID) {
					let oneArr = this.state.operationData && this.state.operationData.length > 0 ? this.state.operationData : [];
					let obj = {}
					for (var i = 0; i < oneArr.length; i++) {
						if (oneArr[i].id === this.state.rowMedID) {
							obj = i > 0 ? oneArr[i] : oneArr[0];
							break;
						}
					}
					this.rowClick(obj)
				}
			} else {
				this.setState({ pageSize: pageSize, page: current }, () => {
					//	this.loadSelectData('', current, pageSize);
					this.getOperationData(this.state.searchCode);
				});
			}
		}

		// //分页切换
		// changePageSize = (current, pageSize) => {
		// 	this.setState({ pageSize: pageSize, page: current }, () => {
		// 		this.getOperationData(this.state.searchCode);
		// 	});
		// }

		//列修改为input框，change事件处理
		handleSearchInput(name, index, data, e) {
			let tableData = this.state.tableData;
			let top = document.getElementById(name + "-input" + index).getBoundingClientRect().top + 40
			let left = document.getElementById(name + "-input" + index).getBoundingClientRect().left;
			let windowHeight = window.innerHeight;
			if ((top + 360) > windowHeight) {
				top = top - 330 - 80;
			}
			top = top + "px";
			left = left + "px";
			var value = e.target.value;
			tableData[index][name] = value;
			this.setState({
				top: top,
				left: left,
				selectIndex: index,
				editingKey: index,
				tableData: tableData,
				changename: name,
				changeValue: value,
				operationData: [],
				total: 0,
				page: 1,
			})
			if (value.length >= 2) {
				this.loadSelectData(value, '', '')
			} else {
				this.setState({
					operationData: [],
					total: 0,
					page: 1,
				})
			}
			document.addEventListener('elementTable', this.loadListener)
		}

		//诊断名称获取焦点时触发
		onDiagDescFocus = (index, e) => {
			this.setState({
				selectIndex: index,
			})
		}

		//操作弹框
		onClickRowPublic = (record, index) => {
			return {
				onDoubleClick: () => {
					// if (!record.categoryID) {
					// 	message.warning('该手术无手术级别，请与医务科联系')
					// 	return;
					// }
					let { tableData, editingKey } = this.state;
					tableData[editingKey].operationID = record.id;
					tableData[editingKey].operationDesc = record.descripts;
					tableData[editingKey].categoryID = record.categoryID;
					tableData[editingKey].insuCode = record?.insuCode || '';
					tableData[editingKey].insuDesc = record?.insuDesc || '';
					this.setState({ tableData }, () => {
						this.child.handleCancel();
					})
				},
				onClick: () => {
					this.setState({
						rowMedID: record.id
					})
				}
			}
		}

		setRowClassNamePublic = (record) => {
			return record.id === this.state.rowMedID ? 'clickRowStyle' : '';
		}

		handleOnKeydown(e) {
			var e = window.event || e;
			let scroll_height = document.getElementsByClassName('clickRowStyle')[0] ? document.getElementsByClassName('clickRowStyle')[0].clientHeight : 26;
			if (scrollCount < 0) {
				scrollCount = 0
			}
			let id = '';
			let oneArr = this.state.operationData && this.state.operationData.length > 0 ? this.state.operationData : [];
			switch (e.keyCode) {
				case 13:
					if ((this.state.rowMedID) && (e.target.nodeName != "INPUT")) {
						let obj = {}
						for (var i = 0; i < oneArr.length; i++) {
							if (oneArr[i].id === this.state.rowMedID) {
								obj = i > 0 ? oneArr[i] : oneArr[0];
								break;
							}
						}

						this.rowClick(obj);

					}
					break;
				case 38: //上
					if (this.state.rowMedID) {
						for (var i = 0; i < oneArr.length; i++) {
							if (oneArr[i].id === this.state.rowMedID) {
								id = i > 0 ? oneArr[i - 1].id : oneArr[0].id;
								break;
							}
						}
						this.setState({ rowMedID: id }, () => {
							// var gundong = document.getElementById("gundong");
							// gundong.scrollTop = gundong.scrollTop - scroll_height;
							scrollCount -= document.getElementsByClassName('clickRowStyle')[0].clientHeight
							var gundong = ''
							gundong = document.getElementsByClassName('ant-table-body')[1]
							if (gundong) {
								gundong.scrollTop = gundong.scrollTop - scroll_height;
							}
						})
					} else {
						this.setState({ rowMedID: oneArr[0].id })
					}
					break;
				case 40: //下
					if (this.state.rowMedID) {
						for (let i = 0; i < oneArr.length; i++) {
							if (oneArr[i].id === this.state.rowMedID) {
								id = i + 1 >= oneArr.length ? oneArr[oneArr.length - 1].id : oneArr[i + 1].id;
								break;
							}
						}
						this.setState({ rowMedID: id }, () => {
							// var gundong = document.getElementById("gundong");
							// gundong.scrollTop = gundong.scrollTop + scroll_height;
							scrollCount += document.getElementsByClassName('clickRowStyle')[0].clientHeight
							var gundong = ''
							gundong = document.getElementsByClassName('ant-table-body')[1]
							if (gundong) {
								gundong.scrollTop = gundong.scrollTop + scroll_height;
							}
						})
					} else {
						this.setState({ rowMedID: oneArr[0].id })
					}
					break;
			}
		}

		//取消弹框显示，焦点问题
		handleFocus() {
			this.setState({
				operationData: []
			}, () => {
				if ((this["operationDesc" + this.state.selectIndex]) && (this["operationDesc" + this.state.selectIndex].current)) {
					this["operationDesc" + this.state.selectIndex].current.focus()
				}
			})
		}

		///下拉框双击
		rowClick = (record, index, e) => {
			let { tableData, editingKey } = this.state;
			// if (!record.categoryID) {
			// 	message.warning('该手术无手术级别，请与医务科联系')
			// 	return;
			// }
			tableData[editingKey].operationID = record.id;
			tableData[editingKey].operationDesc = record.descripts;
			tableData[editingKey].categoryID = record.categoryID;
			this.setState({ tableData }, () => {
				this.child.handleCancel();
			})
		}

		showCommonTableModal(index, data, name, e) {
			if (e.keyCode == '13') {
				if (data[name]) {
					this.setState({
						isShowCommonTableModal: true,
						operationData: data,
						search: "1",
					}, () => {
						// this.loadSelectData(data[name], '', '')
						this.child.showModal();
					})
				}
			}
		}

		handleLeftEyeInventory = (type, value, option) => {
			let leftEyeCrystalData = {}
			if (type == "model") {
				leftEyeCrystalData.crystalModelID = value;
				leftEyeCrystalData.crystalDegreeID = this.state.leftEyeCrystalData.crystalDegreeID
			}
			else {
				leftEyeCrystalData.crystalDegreeID = value;
				leftEyeCrystalData.crystalModelID = this.state.leftEyeCrystalData.crystalModelID
			}
			this.setState({ leftEyeCrystalData })
			if ((leftEyeCrystalData.crystalModelID && leftEyeCrystalData.crystalModelID.trim().length > 0)
				&& (leftEyeCrystalData.crystalDegreeID && leftEyeCrystalData.crystalDegreeID.trim().length > 0)) {
				//调用接口
				this.getEyeCrystalNum("L", leftEyeCrystalData)
			}
			else
				this.setState({ leftEyeCrystalInventory: -1 })

		}

		handleRightEyeInventory = (type, value, option) => {
			let rightEyeCrystalData = {}
			if (type == "model") {
				rightEyeCrystalData.crystalModelID = value;
				rightEyeCrystalData.crystalDegreeID = this.state.rightEyeCrystalData.crystalDegreeID
			}
			else {
				rightEyeCrystalData.crystalDegreeID = value;
				rightEyeCrystalData.crystalModelID = this.state.rightEyeCrystalData.crystalModelID
			}
			this.setState({ rightEyeCrystalData })
			if ((rightEyeCrystalData.crystalModelID && rightEyeCrystalData.crystalModelID.trim().length > 0)
				&& (rightEyeCrystalData.crystalDegreeID && rightEyeCrystalData.crystalDegreeID.trim().length > 0)) {
				//调用接口
				this.getEyeCrystalNum("R", rightEyeCrystalData)
			}
			else
				this.setState({ rightEyeCrystalInventory: -1 })

		}

		getEyeCrystalNum = (type, eyeCrystalData) => {
			// {"params":[{"medID":"2965","degrees":"213","hospID":"25"}]} 
			const userData = sessionStorage.userData ? JSON.parse(sessionStorage.userData) : {}
			let data = {
				params: [{
					hospID: userData.hospID,
					medID: eyeCrystalData.crystalModelID,
					degrees: eyeCrystalData.crystalDegreeID
				}]
			}
			$http.post('urlS', this, {
				code: "02060207",
				data: data,
				success: function (res) {
					if (res.errorCode == '0') {
						console.log(res.count)
						if (type == "R")
							this.setState({ rightEyeCrystalInventory: res.count })
						else
							this.setState({ leftEyeCrystalInventory: res.count })

					}
					else {
						message.error('判断晶体库存异常：' + res.errorMessage);
						if (type == "R")
							this.setState({ rightEyeCrystalInventory: -1 })
						else
							this.setState({ leftEyeCrystalInventory: -1 })
					}
				},
				error: function (error) {
					message.error('判断晶体库存异常：' + error);
					if (type == "R")
						this.setState({ rightEyeCrystalInventory: -1 })
					else
						this.setState({ leftEyeCrystalInventory: -1 })
				}
			});


		}

		clearUIData = () => {
			if (this.props.close)
				this.props.close();
			this.setState({ operationApplyInfo: {}, tableData: [] }, () => {
				this.props.form.resetFields();
				this.props.form.setFieldsValue({ operationRoomID: this.state.operationRoomData[0].id })
				this.addRow()
			});

		}

		// 获取手术列表弹窗表单数据
		getOperationColumns = () => {
			const { showInsuInfoFlag } = this.state;
			let insuColumns = [{
				title: "医保手术编码",
				dataIndex: 'insuCode',
				width: '100px',
				align: 'center',
				render: (text, record) => {
					return (
						<Tooltip title={text}>
							<span className='ellipsis' style={{ width: '100%', display: 'block' }}>{text}</span>
						</Tooltip>
					);
				},
			}, {
				title: "医保手术名称",
				dataIndex: 'insuDesc',
				width: '200px',
				align: 'center',
				render: (text, record) => {
					return (
						<Tooltip title={text}>
							<span className='ellipsis' style={{ width: '100%', display: 'block' }}>{text}</span>
						</Tooltip>
					);
				},
			}];
			let operateObj = {
				key: 10,
				title: () => this.display('OperationApplyoperate'),
				dataIndex: 'operate',
				align: "center",
				width: '150px',
				render: (text, record) => {
					const { editingKey } = this.state;
					const editable = this.isEditing(record);
					return editable ? (
						<span>
							<a onClick={(e) => this.handleUpdate(record, e)}>{this.display('OperationApplyconfirm')}</a>
							<Divider type="vertical" />
							<a onClick={(e) => this.handleCancel(record, e)}>{this.display('OperationApplycancelT')}</a>
						</span>
					) : (
						<span>
							<a disabled={(editingKey !== '') ? true : this.state.disabledAll} onClick={(e) => this.handleEdit(record, e)}>{this.display('OperationApplyedit')}</a>
							<Divider type="vertical" />
							<a style={((this.state.disabledAll) || (editingKey !== '')) ? null : { color: 'rgba(240,65,52,1)' }} disabled={(editingKey !== '') ? true : this.state.disabledAll} onClick={(e) => this.handleDelete(record, e)}>{this.display('OperationApplydelete')}</a>
						</span>
					);
				}
			}
			this.setState({
				operationColumns: showInsuInfoFlag === 'Y' ? [...this.operationColumns, ...insuColumns] : this.operationColumns,
				columns: showInsuInfoFlag === 'Y' ? [...this.columns, ...insuColumns, operateObj] : [...this.columns, operateObj]
			})
		}

		// 历史配置
		handleHistoricalConfig = () => {
			this.historyConfigRef && this.historyConfigRef.modifyVisible(true);
		}

		// 确认
		handleHistoryConfigOk = (dataInfo) => {
			console.log('dataInfo', dataInfo)
			this.getOperationRoomData(dataInfo.operationLocID, 'N');
			this.getCrystalsModel(dataInfo.operationLocID);
			this.setState({
				operationApplyInfo: dataInfo,
				tableData: dataInfo.operationDetail,
				disabledAll: false
			}, () => {
				this.props.form.setFieldsValue({
					operationRoomID: dataInfo.operationRoomID,
					operationLocID: dataInfo.operationLocID ? dataInfo.operationLocID : '',
					duration: dataInfo.duration ? dataInfo.duration : '',
					applyNumber: dataInfo.applyNumber ? dataInfo.applyNumber : '',
					operatingSurgeon: dataInfo.operatingSurgeon ? dataInfo.operatingSurgeon : '',
					firstAssistant: dataInfo.firstAssistant ? dataInfo.firstAssistant : '',
					secondAssistant: dataInfo.secondAssistant ? dataInfo.secondAssistant : '',
					thirdAssistant: dataInfo.thirdAssistant ? dataInfo.thirdAssistant : '',
					otherAssistant: dataInfo.otherAssistant ? dataInfo.otherAssistant : '',
					anaesthesiaID: dataInfo.anaesthesiaID ? dataInfo.anaesthesiaID : '',
					anaesthesiaDoctorID: dataInfo.anaesthesiaDoctorID ? dataInfo.anaesthesiaDoctorID : '',
					ecgDoctorID: dataInfo.ecgDoctorID ? dataInfo.ecgDoctorID : '',
					applyDocNotes: dataInfo.applyDocNotes ? dataInfo.applyDocNotes : '',
					motivation: dataInfo.Motive ? dataInfo.Motive : '',
					surgicalPopulation: dataInfo.CrowdDr ? dataInfo.CrowdDr : '',
					specialEquipment: dataInfo.specialEquipment ? dataInfo.specialEquipment : '',
					positionID: dataInfo.positionID ? dataInfo.positionID : '',
					bloodType: dataInfo.bloodType ? dataInfo.bloodType : '',
					RHBlood: dataInfo.RHBlood ? dataInfo.RHBlood : '',
					HbsAg: dataInfo.HbsAg ? dataInfo.HbsAg : '',
					HcvAb: dataInfo.HcvAb ? dataInfo.HcvAb : '',
					HivAb: dataInfo.HivAb ? dataInfo.HivAb : '',
					syphilis: dataInfo.syphilis ? dataInfo.syphilis : '',
					notes: dataInfo.notes ? dataInfo.notes : '',
					crystalsModelID: dataInfo.crystalsModelID ? dataInfo.crystalsModelID : '',
					crystalsStrengthID: dataInfo.crystalsStrengthID ? dataInfo.crystalsStrengthID : '',
					crystalsNum: dataInfo.crystalsNum ? dataInfo.crystalsNum : '1',
					rcrystalsModelID: dataInfo.rcrystalsModelID ? dataInfo.rcrystalsModelID : '',
					rcrystalsStrengthID: dataInfo.rcrystalsStrengthID ? dataInfo.rcrystalsStrengthID : '',
					rcrystalsNum: dataInfo.rcrystalsNum ? dataInfo.rcrystalsNum : '1',
					rastigmatism: dataInfo.rastigmatism ? dataInfo.rastigmatism : '',
					astigmatism: dataInfo.astigmatism ? dataInfo.astigmatism : ''
				});
				// this.addRow();
			})
		}

		render() {
			const { page, total, top, left, columns, operationColumns, ordDateSubtract } = this.state;
			const { getFieldDecorator } = this.props.form;
			let operationApplyInfo = this.state.operationApplyInfo ? this.state.operationApplyInfo : {}
			const formItemLayout = {    // label 和input宽度
				labelCol: { span: 8 },
				wrapperCol: { span: 16 },
			};
			const formItemProLayout = {    // label 和input宽度
				labelCol: { span: 4 },
				wrapperCol: { span: 20 },
			};
			const formItemProLayoutAdd = {    // label 和input宽度
				labelCol: { span: 2 },
				wrapperCol: { span: 19 },
			};
			const formItemEquip = {    // label 和input宽度
				labelCol: { span: 2 },
				wrapperCol: { span: 22 },
			};
			const formItemAdd = {    // label 和input宽度
				labelCol: { span: 8 },
				wrapperCol: { span: 16 },
			};
			const formItemLayoutCheck = {
				labelCol: { span: 7 },
				wrapperCol: { span: 25 },
			}
			let formData = this.props.form.getFieldsValue();
			const selectedOperationUser = [formData.operatingSurgeon, formData.firstAssistant, formData.secondAssistant, formData.thirdAssistant, formData.otherAssistant]
			// 手术弹框参数
			let param = {
				width: '800px',
				height: 330,
				top: top,
				left: left,
				bordered: true,
				columns: operationColumns && operationColumns.length > 0 ? operationColumns : this.operationColumns,
				data: this.state.operationData,
				isOnRow: true,
				TableClassName: 'tab-placeholder',
				rowClassName: true,
				showPagination: true,
				total,
				page,
				x: 600,
			}

			return (
				<div className="OperationContent" style={{ height: "100%", overflow: "hidden" }}>
					<div className='outpatient-station-body' style={{ width: '100%', height: "100%" }}>
						<Row style={{ borderBottom: '1px solid #EEEEEE', display: this.props.operationID ? 'none' : '' }}>
							<Col span={24} style={{ display: 'flex', flexDirection: 'row' }}>
								<div style={{ width: '24%', borderRight: '1px solid #EEEEEE', height: 120, display: 'flex' }}>
									<div className="other" style={{ display: 'flex', flexShrink: '1', flex: '0 0 auto', width: 100 }}>
										<div className={this.state.titleData && this.state.titleData.basicInfo.patSexCode == '1' ?
											'splice-boy' : (this.state.titleData && this.state.titleData.basicInfo.patSexCode == '2' ? 'splice-girl' : 'splice-other')}></div>
										<span className="bed">{this.state.titleData ? this.state.titleData.admInfo.admBedCode : ''}</span>
									</div>
									<div style={{ display: 'flex', flex: '1 1 auto', flexDirection: 'column' }}>
										{/* <div style={{ padding: '10px 0 0 20px' }}></div> */}
										<div style={{ padding: '10px 0 0 20px' }} className="item">
											<div>
												<i className="icon"></i>
												<span>{this.state.titleData ? this.state.titleData.basicInfo.patName : ''}</span>
											</div>
											<div>
												<i className="icon"></i>
												<span>{this.state.titleData ? this.state.titleData.basicInfo.patSexDesc : ''}</span>
											</div>
											<div>
												<i className="icon"></i>
												<span>{this.state.titleData ? this.state.titleData.basicInfo.patAge : ''}</span>
											</div>
										</div>
										<div style={{ fontWeight: 400, color: '#666666', fontSize: '16px', padding: '10px 0 0 20px' }} className="item">
											<div>
												<i className="icon"></i>
												<span>{this.state.titleData ? this.state.titleData.admInfo.admLocDesc : ''}</span>
											</div>
											<div>
												<i className="icon"></i>
												<span>{this.state.titleData ? this.state.titleData.admInfo.admWardDesc : ''}</span>
											</div>
										</div>
										<div style={{ fontWeight: 400, color: '#666666', fontSize: '16px', padding: '10px 0 0 20px' }} className="item">
											<div>
												<i className="icon"></i>
												<span>{this.state.titleData ? this.state.titleData.basicInfo.patBirthDate : ''}</span>
												<span>{this.state.titleData ? this.state.titleData.basicInfo.patBirthTime : ''}</span>
											</div>
										</div>
									</div>
								</div>
								<div style={{ width: '76%', height: '120px' }}>
									<div style={{ width: '100%', padding: '6px 0', margin: '10px 0 0 18px' }}>
										<span style={{ marginTop: 20, marginLeft: '0px' }}>{this.display('OperationApplyapploc')}:<span className='operationa-apply-info'>{operationApplyInfo && operationApplyInfo.applyLocDesc ? operationApplyInfo.applyLocDesc : userData.locDesc}</span></span>
										<span style={{ marginTop: 20, marginLeft: '5%' }}>{this.display('OperationApplyappDoc')}:<span className='operationa-apply-info'>{operationApplyInfo && operationApplyInfo.applyDocDesc ? operationApplyInfo.applyDocDesc : userData.userName}</span></span>
									</div>
									<div className='doctor-step-cls' style={{ marginLeft: '20px' }}>
										<Col span={1} style={{ textAlign: 'right' }}>
											<span>{this.display('OperationApplydiag')}：</span>
										</Col>
										<Col span={23} style={{ textAlign: 'left', width: '94%' }}>
											<TextArea style={{ width: '100%', overflowY: 'auto' }} autoSize={{ minRows: 3, maxRows: 3 }} disabled draggable value={this.state.diag}></TextArea>
										</Col>
									</div>
								</div>
							</Col>
						</Row>

						<div style={{ height: 'calc(100% - 176px)' }} className="contentTemp">
							<Row style={{ height: '100%' }}>
								<Form style={{ height: '100%', overflowX: 'hidden' }}>
									<div className="form-item">
										<Row style={{ width: '100%', padding: '8px 18px 0 0' }}>
											<Col span={4} >
												<FormItem {...formItemLayout} label={this.display('OperationApplyoperationLoc')}>
													{getFieldDecorator('operationLocID', {
														initialValue: operationApplyInfo.operationLocID ? operationApplyInfo.operationLocID : this.state.defOperationLocID,
														rules: [{ required: true, message: this.display('OperationApplyselect'), }]
													})(
														<Select onChange={this.changeOperationLoc} showSearch allowClear optionFilterProp="role" disabled={this.state.disabledAll} >
															{this.state.operationLocData.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode} workDate={data.workDate} offWorkTime={data.offWorkTime} >{data.descripts}</Select.Option>))}
														</Select>
													)}
												</FormItem>
											</Col>
											<Col span={5} >
												<FormItem {...formItemLayout} label={this.display('OperationApplyoperationRoom')}>
													{getFieldDecorator('operationRoomID', {
														initialValue: operationApplyInfo.operationRoomID ? operationApplyInfo.operationRoomID : '',
														// rules: [{ required: true, message: '请选择...', }]
													})(
														<Select showSearch allowClear optionFilterProp="role" disabled={this.state.disabledAll} >
															{this.state.operationRoomData.map(data => (<Select.Option key={data.id + ""} value={data.id + ""} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}>{data.descripts}</Select.Option>))}
														</Select>
													)}
												</FormItem>
											</Col>
											<Col span={5}>
												<FormItem {...formItemLayout} label={this.display('OperationApplyoperationDate')}>
													{getFieldDecorator('operationDate', {
														initialValue: operationApplyInfo.operationDate ? moment(operationApplyInfo.operationDate, 'YYYY-MM-DD') : moment(moment().add(1, 'day'), 'YYYY-MM-DD'),
														rules: [{ required: true, message: this.display('OperationApplyselect'), }]
													})(
														<DatePicker style={{ width: '100%' }}
															disabledDate={(curDate) => {
																return curDate && curDate < moment().subtract(2, 'days');
															}}
															disabled={this.state.disabledAll}></DatePicker>
													)}
												</FormItem>
											</Col>
											<Col span={5}>
												<FormItem {...formItemLayout} label={this.display('OperationApplyoperationTime')}>
													{getFieldDecorator('operationTime', {
														initialValue: operationApplyInfo.operationTime ? moment(operationApplyInfo.operationTime, 'HH:mm') : null,
														rules: [{ required: false, message: this.display('OperationApplyselect'), }]
													})(
														<TimePicker
															style={{ width: '100%' }}
															disabled={this.state.disabledAll}
															format='HH:mm'
															disabledHours={this.getDisabledHours}
															disabledMinutes={this.getDisabledMinutes}
														></TimePicker>
													)}
												</FormItem>
											</Col>
											<Col span={5} >
												<FormItem {...formItemLayout} label={this.display('OperationApplyduration')}>
													{getFieldDecorator('duration', {
														initialValue: operationApplyInfo.duration ? operationApplyInfo.duration : '',
													})(
														<Input disabled={this.state.disabledAll} />
													)}
												</FormItem>
											</Col>
										</Row>
										<Row style={{ width: '100%', padding: '0px 18px 0 0' }}>
											<Col span={4} >
												<FormItem {...formItemLayout} label={this.display('OperationApplyoperatingSurgeon')}>
													{getFieldDecorator('operatingSurgeon', {
														initialValue: operationApplyInfo.operatingSurgeon ? operationApplyInfo.operatingSurgeon : '',
														rules: [{ required: true, message: this.display('OperationApplyselect'), }]
													})(
														<Select showSearch allowClear optionFilterProp="role" disabled={this.state.disabledAll} >
															{this.state.operationDocData.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode} disabled={selectedOperationUser.includes(data.id)}>{data.descripts}</Select.Option>))}
														</Select>
													)}
												</FormItem>
											</Col>
											<Col span={5} >
												<FormItem {...formItemLayout} label={this.display('OperationApplyfirstAssistant')}>
													{getFieldDecorator('firstAssistant', {
														initialValue: operationApplyInfo.firstAssistant ? operationApplyInfo.firstAssistant : '',
													})(
														<Select showSearch allowClear optionFilterProp="role" disabled={this.state.disabledAll} >
															{this.state.operationDocData.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode} disabled={selectedOperationUser.includes(data.id)} >{data.descripts}</Select.Option>))}
														</Select>
													)}
												</FormItem>
											</Col>
											<Col span={5} >
												<FormItem {...formItemLayout} label={this.display('OperationApplysecondAssistant')}>
													{getFieldDecorator('secondAssistant', {
														initialValue: operationApplyInfo.secondAssistant ? operationApplyInfo.secondAssistant : '',

													})(
														<Select showSearch allowClear optionFilterProp="role" disabled={this.state.disabledAll}>
															{this.state.operationDocData.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode} disabled={selectedOperationUser.includes(data.id)} >{data.descripts}</Select.Option>))}
														</Select>
													)}
												</FormItem>
											</Col>
											<Col span={5} >
												<FormItem {...formItemLayout} label={this.display('OperationApplythirdAssistant')}>
													{getFieldDecorator('thirdAssistant', {
														initialValue: operationApplyInfo.thirdAssistant ? operationApplyInfo.thirdAssistant : '',
													})(
														<Select showSearch allowClear optionFilterProp="role" disabled={this.state.disabledAll} >
															{this.state.operationDocData.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode} disabled={selectedOperationUser.includes(data.id)} >{data.descripts}</Select.Option>))}
														</Select>
													)}
												</FormItem>
											</Col>
											<Col span={5}>
												<FormItem {...formItemLayout} label={this.display('OperationApplyotherAssistant')}>
													{getFieldDecorator('otherAssistant', {
														initialValue: operationApplyInfo.otherAssistant ? operationApplyInfo.otherAssistant : '',
													})(
														<Select showSearch allowClear optionFilterProp="role" disabled={this.state.disabledAll}>
															{this.state.operationDocData.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode} disabled={selectedOperationUser.includes(data.id)} >{data.descripts}</Select.Option>))}
														</Select>
													)}
												</FormItem>
											</Col>
										</Row>
										<Row style={{ width: '100%', padding: '0px 18px 0 0' }}>
											<Col span={4}>
												<FormItem {...formItemLayout} label={this.display('OperationApplyapplyNumber')}>
													{getFieldDecorator('applyNumber', {
														initialValue: operationApplyInfo.applyNumber ? operationApplyInfo.applyNumber : '',
													})(
														<Input disabled={this.state.disabledAll} />
													)}
												</FormItem>
											</Col>
											<Col span={5}>
												<FormItem {...formItemLayout} label={this.display('OperationApplyanesthesia')}>
													{getFieldDecorator('anaesthesiaID', {
														initialValue: operationApplyInfo.anaesthesiaID ? operationApplyInfo.anaesthesiaID : '',
														rules: [{ required: true, message: this.display('OperationApplyselect'), }]
													})(
														<Select disabled={this.state.disabledAll} showSearch optionFilterProp="role" allowClear placeholder="麻醉方式">
															{this.state.anesthesiaData.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}>{data.descripts}</Select.Option>))}
														</Select>
													)}
												</FormItem>
											</Col>
											<Col span={5}>
												<FormItem {...formItemLayout} label={this.display('OperationApplyanaesthesiaDoctor')}>
													{getFieldDecorator('anaesthesiaDoctorID', {
														initialValue: operationApplyInfo.anaesthesiaDoctorID ? operationApplyInfo.anaesthesiaDoctorID : '',
														rules: [{ required: false, message: this.display('OperationApplyselect'), }]
													})(
														<Select disabled={this.state.disabledAll} showSearch optionFilterProp="role" allowClear placeholder="麻醉医师">
															{this.state.anaesthesiaDocaArr.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}>{data.descripts}</Select.Option>))}
														</Select>
													)}
												</FormItem>
											</Col>
											<Col span={10}>
												<FormItem {...formItemProLayout} label={this.display('OperationApplyapplyDocNotes')}>
													{getFieldDecorator('applyDocNotes', {
														initialValue: operationApplyInfo.applyDocNotes ? operationApplyInfo.applyDocNotes : '',
													})(
														<Input disabled={this.state.disabledAll} allowClear />
													)}
												</FormItem>
											</Col>
										</Row>
										<Row style={{ width: '100%', padding: '0px 18px 0 0' }}>
											<Col span={4}>
												<FormItem {...formItemLayout} label={this.display('OperationApplymotivation')}>
													{getFieldDecorator('motivation', {
														initialValue: operationApplyInfo.motivation ? operationApplyInfo.motivation : '',
														// rules: [{ required: true, message: this.display('OperationApplyselect'), }]
													})(
														<Select
															allowClear
															style={{ width: "100%", textAlign: "left" }}
															// onChange={this.handleFieldChange.bind(this, index, 'motivation')}
															showSearch
															optionFilterProp='role'
															placeholder="手术动机"
														>
															{this.state.motivationData.map(data => (
																<Select.Option
																	role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}
																	key={data.id}
																>
																	{data.descripts}
																</Select.Option>))}
														</Select>
													)}
												</FormItem>
											</Col>
											<Col span={5}>
												<FormItem {...formItemLayout} label={this.display('OperationApplysurgicalPopulation')}>
													{getFieldDecorator('surgicalPopulation', {
														initialValue: operationApplyInfo.surgicalPopulation ? operationApplyInfo.surgicalPopulation : '',
														// rules: [{ required: true, message: this.display('OperationApplyselect'), }]
													})(
														<Select
															allowClear
															style={{ width: "100%", textAlign: "left" }}
															// onChange={this.handleFieldChange.bind(this, index, 'surgicalPopulation')}
															showSearch
															optionFilterProp='role'
															placeholder="手术人群"
														>
															{this.state.surgicalPopulationData.map(data => (
																<Select.Option
																	role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}
																	key={data.id}
																>
																	{data.descripts}
																</Select.Option>))}
														</Select>
													)}
												</FormItem>
											</Col>
											<Col span={5}>
												{/* 医嘱日期 */}
												<FormItem {...formItemLayout} label={this.display('OperationApplyordDate')}>
													{getFieldDecorator('ordDate', {
														initialValue: moment(),
														rules: [{ required: false, message: this.display('OperationApplyselect'), }]
													})(
														<DatePicker
															style={{ width: '100%' }}
														// disabledDate={(curDate) => {
														// 	return curDate && curDate < moment().subtract(ordDateSubtract || 2, 'days');
														// }}
														/>
													)}
												</FormItem>
											</Col>
											<Col span={5}>
												{/* 医嘱时间 */}
												<FormItem {...formItemLayout} label={this.display('OperationApplyordTime')}>
													{getFieldDecorator('ordTime', {
														initialValue: moment(),
														rules: [{ required: false, message: this.display('OperationApplyselect'), }]
													})(
														<TimePicker
															style={{ width: '100%' }}
															format="HH:mm"
														// disabledHours={this.getDisabledHours}
														// disabledMinutes={this.getDisabledMinutes}
														/>
													)}
												</FormItem>
											</Col>
										</Row>
										<Row>
											<Col span={8}>
												<FormItem label={this.display('OperationApplytype')} {...formItemProLayout} style={{ marginBottom: '0' }}>
													{getFieldDecorator('type', {
														initialValue: operationApplyInfo.type ? operationApplyInfo.type : 'E',
													})(
														<Radio.Group disabled={this.state.disabledAll} onChange={this.changeType}>
															<Radio value={'E'}>择期手术</Radio>
															<Radio value={'D'}>日间手术</Radio>
															<Radio value={'EM'}>急诊手术</Radio>
														</Radio.Group>
													)}
												</FormItem>
											</Col>
											<Col span={2} style={{ float: 'left', paddingLeft: "31px", boxSizing: "border-box" }}>
												<FormItem {...formItemLayoutCheck}>
													{getFieldDecorator('ecg', {
														initialValue: operationApplyInfo.ecg
													})(
														<Checkbox disabled={this.state.disabledAll} checked={operationApplyInfo.ecg === 'Y' ? true : false} onChange={this.checkboxOnchange.bind(this, 'ecg')}>{this.display('OperationApplyecg')}</Checkbox>
													)}
												</FormItem>
											</Col>
											<Col span={5}>
												<FormItem {...formItemLayout} label={this.display('OperationApplyecgDoctor')}>
													{getFieldDecorator('ecgDoctorID', {
														initialValue: operationApplyInfo.ecgDoctorID ? operationApplyInfo.ecgDoctorID : '',
														rules: [{ required: false, message: this.display('OperationApplyselect'), }]
													})(
														<Select disabled={this.state.disabledAll} showSearch optionFilterProp="role" allowClear placeholder="心电监护医师">
															{this.state.docECGDocArr.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}>{data.descripts}</Select.Option>))}
														</Select>
													)}
												</FormItem>
											</Col>
										</Row>
									</div>

									<div className="form-item">
										<Row style={{ margin: '0px 18px 0 0', paddingTop: '11px', width: '100%' }}>
											<Col span={24} style={{ padding: '0 24px', display: 'flex', justifyContent: 'space-between' }}>
												<div><span style={{ color: 'red' }}>*</span>{this.display('OperationApplysurgery')}：</div>
												<span disabled={this.state.disabledAll} style={{ color: 'rgba(247,128,93,1)' }} type='primary' size='small' onClick={this.addRow}>{this.display('OperationApplyadd')}</span>
											</Col>
											<Col span={24}>
												<Table
													style={{ minHeight: '162px', padding: '0 24px', marginTop: '10px' }}
													columns={columns && columns.length > 0 ? columns : this.columns}
													scroll={{ y: 150 }}
													dataSource={this.state.tableData}
													pagination={false}
													bordered
												/>
											</Col>
										</Row>
									</div>

									<div className="form-item">
										<Row style={{ width: '100%', padding: '0px 18px 0 0' }}>
											<Col span={5}>
												<FormItem {...formItemLayout} label={'右眼' + this.display('OperationApplycrystalsModel')} >
													{getFieldDecorator('rcrystalsModelID', {
														initialValue: operationApplyInfo.rcrystalsModelID ? operationApplyInfo.rcrystalsModelID : '',
													})(
														<Select showSearch allowClear optionFilterProp="role" disabled={this.state.disabledAll} onChange={(value, option) => { this.handleRightEyeInventory("model", value, option) }}>
															{this.state.crystalsModelArr.map(data => (
																<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode + '^' + data.spec}>{data.spec + ' [' + data.descripts + ']'}</Select.Option>))}
														</Select>
													)}
												</FormItem>
											</Col>
											<Col span={5}>
												<FormItem {...formItemLayout} label={this.display('OperationApplycrystalsStrength')}>
													{getFieldDecorator('rcrystalsStrengthID', {
														initialValue: operationApplyInfo.rcrystalsStrengthID ? operationApplyInfo.rcrystalsStrengthID : '',
													})(
														<Select showSearch allowClear optionFilterProp="role" disabled={this.state.disabledAll} onChange={(value, option) => { this.handleRightEyeInventory("degree", value, option) }}>
															{this.state.crystalsStrengthArr.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}>{data.descripts}</Select.Option>))}
														</Select>
													)}
												</FormItem>
											</Col>
											<Col span={1} >
												<FormItem {...formItemLayout} >
													{
														this.state.rightEyeCrystalInventory == -1 ? "" : (this.state.rightEyeCrystalInventory == 0 ? <span style={{ color: 'red', marginLeft: '10px' }}>无库存</span> : <span style={{ color: 'blue', marginLeft: '10px' }}>有库存</span>)
													}
												</FormItem>
											</Col>
											<Col span={4}>
												<FormItem {...formItemLayout} label={this.display('OperationApplycrystalsNum')}>
													{getFieldDecorator('rcrystalsNum', {
														initialValue: operationApplyInfo.rcrystalsNum ? operationApplyInfo.rcrystalsNum : '1',
														required: false
													})(
														<Input disabled={this.state.disabledAll} allowClear />
													)}
												</FormItem>
											</Col>
											<Col span={5}>
												<FormItem {...formItemLayout} label={this.display('OperationApplycrystalsAstigmatism')}>
													{getFieldDecorator('rastigmatism', {
														initialValue: operationApplyInfo.rastigmatism ? operationApplyInfo.rastigmatism : '',
														required: false
													})(
														<Input disabled={this.state.disabledAll} allowClear />
													)}
												</FormItem>
											</Col>
											<Col span={4}>
												<FormItem {...formItemLayout} label={this.display('OperationApplycrystalsRepReason')}>
													{getFieldDecorator('rcrystalsRepReasonID', {
														initialValue: operationApplyInfo.rcrystalsRepReasonID ? operationApplyInfo.rcrystalsRepReasonID : '',
													})(
														<Select showSearch allowClear optionFilterProp="role" disabled={this.props.operationID ? false : true}>
															{this.state.crystalsRepReasonArr.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}>{data.descripts}</Select.Option>))}
														</Select>
													)}
												</FormItem>
											</Col>
										</Row>
										<Row style={{ width: '100%', padding: '0px 18px 0 0' }}>
											<Col span={5}>
												<FormItem {...formItemLayout} label={'左眼' + this.display('OperationApplycrystalsModel')} >
													{getFieldDecorator('crystalsModelID', {
														initialValue: operationApplyInfo.crystalsModelID ? operationApplyInfo.crystalsModelID : '',
													})(
														<Select showSearch allowClear optionFilterProp="role" disabled={this.state.disabledAll} onChange={(value, option) => { this.handleLeftEyeInventory("model", value, option) }}>
															{this.state.crystalsModelArr.map(data => (
																<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode + '^' + data.spec}>{data.spec + ' [' + data.descripts + ']'}</Select.Option>))}
														</Select>
													)}
												</FormItem>
											</Col>
											<Col span={5}>
												<FormItem {...formItemLayout} label={this.display('OperationApplycrystalsStrength')} >
													{getFieldDecorator('crystalsStrengthID', {
														initialValue: operationApplyInfo.crystalsStrengthID ? operationApplyInfo.crystalsStrengthID : '',
													})(
														<Select showSearch allowClear optionFilterProp="role" disabled={this.state.disabledAll} onChange={(value, option) => { this.handleLeftEyeInventory("degree", value, option) }}>
															{this.state.crystalsStrengthArr.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}>{data.descripts}</Select.Option>))}
														</Select>
													)}
												</FormItem>
											</Col>
											<Col span={1} >
												<FormItem {...formItemLayout} >
													{
														this.state.leftEyeCrystalInventory == -1 ? "" : (this.state.leftEyeCrystalInventory == 0 ? <span style={{ color: 'red', marginLeft: '10px' }}>无库存</span> : <span style={{ color: 'blue', marginLeft: '10px' }}>有库存</span>)
													}
												</FormItem>
											</Col>
											<Col span={4} >
												<FormItem {...formItemLayout} label={this.display('OperationApplycrystalsNum')}>
													{getFieldDecorator('crystalsNum', {
														initialValue: operationApplyInfo.crystalsNum ? operationApplyInfo.crystalsNum : '1',
														required: false
													})(
														<Input disabled={this.state.disabledAll} allowClear />
													)}
												</FormItem>
											</Col>
											<Col span={5}>
												<FormItem {...formItemLayout} label={this.display('OperationApplycrystalsAstigmatism')}>
													{getFieldDecorator('astigmatism', {
														initialValue: operationApplyInfo.astigmatism ? operationApplyInfo.astigmatism : '',
														required: false
													})(
														<Input disabled={this.state.disabledAll} allowClear />
													)}
												</FormItem>
											</Col>
											<Col span={4}>
												<FormItem {...formItemLayout} label={this.display('OperationApplycrystalsRepReason')}>
													{getFieldDecorator('crystalsRepReasonID', {
														initialValue: operationApplyInfo.crystalsRepReasonID ? operationApplyInfo.crystalsRepReasonID : '',
													})(
														<Select showSearch allowClear optionFilterProp="role" disabled={this.props.operationID ? false : true}>
															{this.state.crystalsRepReasonArr.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}>{data.descripts}</Select.Option>))}
														</Select>
													)}
												</FormItem>
											</Col>
										</Row>
										<Row style={{ padding: '0px 18px 0px 0px', width: '100%' }}>
											<Col span={19}>
												<FormItem {...formItemEquip} label={this.display('OperationApplyspecialEquipment')}>
													{getFieldDecorator('specialEquipment', {
														initialValue: operationApplyInfo.specialEquipment ? operationApplyInfo.specialEquipment : '',
													})(
														<Input disabled={this.state.disabledAll} allowClear />
													)}
												</FormItem>
											</Col>
											<Col span={5}>
												<FormItem {...formItemAdd} label={this.display('OperationApplyposition')}>
													{getFieldDecorator('positionID', {
														initialValue: operationApplyInfo.positionID ? operationApplyInfo.positionID : '',
													})(
														<Select showSearch allowClear optionFilterProp="role" disabled={this.state.disabledAll}>
															{this.state.operationPostData.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}>{data.descripts}</Select.Option>))}
														</Select>
													)}
												</FormItem>
											</Col>
										</Row>
										<Row style={{ width: '100%', padding: '0px 18px 0 0' }}>
											<Col span={4}>
												{/* 血型 */}
												<FormItem {...formItemLayout} label={this.display('OperationApplybloodType')}>
													{getFieldDecorator('bloodType', {
														initialValue: operationApplyInfo.bloodType ? operationApplyInfo.bloodType : this.state.defBloodTpyeID,
														rules: [{ required: true, message: this.display('OperationApplyselect'), }]
													})(
														<Select showSearch allowClear optionFilterProp="role" disabled={this.state.disabledAll}>
															{this.state.bloodTpyeData.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}>{data.descripts}</Select.Option>))}
														</Select>
													)}
												</FormItem>
											</Col>
											<Col span={5} >
												{/* RH血型 */}
												<FormItem {...formItemLayout} label={this.display('OperationApplyRHBlood')}>
													{getFieldDecorator('RHBlood', {
														initialValue: operationApplyInfo.RHBlood ? operationApplyInfo.RHBlood : this.state.defRHBloodTypeID,
														rules: [{ required: true, message: this.display('OperationApplyselect'), }]
													})(
														<Select showSearch allowClear optionFilterProp="role" disabled={this.state.disabledAll} >
															{this.state.RHBloodTypeData.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}>{data.descripts}</Select.Option>))}
														</Select>
													)}
												</FormItem>
											</Col>
											<Col span={5} >
												<FormItem {...formItemLayout} label='HbsAg'>
													{getFieldDecorator('HbsAg', {
														initialValue: operationApplyInfo.HbsAg ? operationApplyInfo.HbsAg : this.state.defHbsAgTraitsID,
														rules: [{ required: true, message: this.display('OperationApplyselect'), }]
													})(
														<Select showSearch allowClear optionFilterProp="role" disabled={this.state.disabledAll}>
															{this.state.HbsAgTraitsData.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}>{data.descripts}</Select.Option>))}
														</Select>
													)}
												</FormItem>
											</Col>
											<Col span={5} >
												<FormItem {...formItemLayout} label='Hcv_Ab'>
													{getFieldDecorator('HcvAb', {
														initialValue: operationApplyInfo.HcvAb ? operationApplyInfo.HcvAb : this.state.defHcvAbTraitsID,
														rules: [{ required: true, message: this.display('OperationApplyselect'), }]
													})(
														<Select showSearch allowClear optionFilterProp="role" disabled={this.state.disabledAll} >
															{this.state.HcvAbTraitsData.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}>{data.descripts}</Select.Option>))}
														</Select>
													)}
												</FormItem>
											</Col>
											<Col span={5} >
												<FormItem {...formItemLayout} label='Hiv_Ab'>
													{getFieldDecorator('HivAb', {
														initialValue: operationApplyInfo.HivAb ? operationApplyInfo.HivAb : this.state.defHivAbTraitsID,
														rules: [{ required: true, message: this.display('OperationApplyselect'), }]
													})(
														<Select showSearch allowClear optionFilterProp="role" disabled={this.state.disabledAll} >
															{this.state.HivAbTraitsData.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}>{data.descripts}</Select.Option>))}
														</Select>
													)}
												</FormItem>
											</Col>
										</Row>
										<Row>
											<Col span={4} >
												<FormItem {...formItemLayout} label={this.display('OperationApplysyphilis')}>
													{getFieldDecorator('syphilis', {
														initialValue: operationApplyInfo.syphilis ? operationApplyInfo.syphilis : this.state.defSyphilisTraitsID,
														rules: [{ required: true, message: this.display('OperationApplyselect'), }]
													})(
														<Select showSearch allowClear optionFilterProp="role" disabled={this.state.disabledAll}>
															{this.state.syphilisTraitsData.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}>{data.descripts}</Select.Option>))}
														</Select>
													)}
												</FormItem>
											</Col>
											<Col span={20}>
												<FormItem {...formItemProLayoutAdd} label={this.display('OperationApplynotes')}>
													{getFieldDecorator('notes', {
														initialValue: operationApplyInfo.notes ? operationApplyInfo.notes : '',
													})(
														<Input disabled={this.state.disabledAll} allowClear />
													)}
												</FormItem>
											</Col>
										</Row>
										<Row gutter={12}>
											<Col style={{ float: 'left', paddingLeft: "110px", boxSizing: "border-box" }}>
												<FormItem {...formItemLayoutCheck}>
													{getFieldDecorator('quarantine', {
														initialValue: operationApplyInfo.quarantine
													})(
														<Checkbox disabled={this.state.disabledAll} checked={operationApplyInfo.quarantine === 'Y' ? true : false} onChange={this.checkboxOnchange.bind(this, 'quarantine')} >{this.display('OperationApplyquarantine')}</Checkbox>
													)}
												</FormItem>
											</Col>
											<Col style={{ float: 'left', paddingLeft: "31px", boxSizing: "border-box" }}>
												<FormItem  {...formItemLayoutCheck}>
													{getFieldDecorator('CPB', {
														initialValue: operationApplyInfo.CPB
													})(
														<Checkbox disabled={this.state.disabledAll} checked={operationApplyInfo.CPB === 'Y' ? true : false} onChange={this.checkboxOnchange.bind(this, 'CPB')}>{this.display('OperationApplyCPB')}</Checkbox>
													)}
												</FormItem>
											</Col>
											<Col style={{ float: 'left', paddingLeft: "31px", boxSizing: "border-box" }}>
												<FormItem  {...formItemLayoutCheck}>
													{getFieldDecorator('selfBloodRtn', {
														initialValue: operationApplyInfo.selfBloodRtn
													})(
														<Checkbox disabled={this.state.disabledAll} checked={operationApplyInfo.selfBloodRtn === 'Y' ? true : false} onChange={this.checkboxOnchange.bind(this, 'selfBloodRtn')}>{this.display('OperationApplyselfBloodRtn')}</Checkbox>
													)}
												</FormItem>
											</Col>
											<Col style={{ float: 'left', paddingLeft: "31px", boxSizing: "border-box" }}>
												<FormItem {...formItemLayoutCheck}>
													{getFieldDecorator('bloodPrepare', {
														initialValue: operationApplyInfo.bloodPrepare
													})(
														<Checkbox disabled={this.state.disabledAll} checked={operationApplyInfo.bloodPrepare === 'Y' ? true : false} onChange={this.checkboxOnchange.bind(this, 'bloodPrepare')}>{this.display('OperationApplybloodPrepare')}</Checkbox>
													)}
												</FormItem>
											</Col>
											<Col style={{ float: 'left', paddingLeft: "31px", boxSizing: "border-box" }}>
												<FormItem {...formItemLayoutCheck}>
													{getFieldDecorator('frozen', {
														initialValue: operationApplyInfo.frozen
													})(
														<Checkbox disabled={this.state.disabledAll} checked={operationApplyInfo.frozen === 'Y' ? true : false} onChange={this.checkboxOnchange.bind(this, 'frozen')}>{this.display('OperationApplyfrozen')}</Checkbox>
													)}
												</FormItem>
											</Col>
										</Row>
									</div>
								</Form>
							</Row>
						</div>

						<div style={{ paddingTop: '12px', borderTop: '1px solid #e8e8e8' }} className="flex-center">
							<div style={{ margin: '0 8px 0 0', display: this.state.hideCancelFlag === 'Y' ? 'none' : '' }}>
								<Button
									className="btn-botton"
									type='danger'
									htmlType="submit"
									onClick={this.save.bind(this, '11')}
									icon='delete'
									disabled={this.state.clickFlag ? true : this.state.disabledAll || (this.state.statusCode != '01')}
								>取消手术
								</Button>
							</div>
							<div style={{ margin: '0 8px 0 0', display: this.state.locType == 'OP' ? 'none' : '' }}>
								<Button
									className="btn-botton"
									type='danger'
									htmlType="submit"
									onClick={this.save.bind(this, '10')}
									icon='delete'
									disabled={this.state.clickFlag ? true : this.state.disabledAll || (this.state.statusCode != '08' && this.state.statusCode != '09')}
								>{this.display('OperationApplydelete')}
								</Button>
							</div>
							<div style={{ margin: '0 8px', display: this.state.locType == 'OP' ? 'none' : '' }}>
								<Button
									className="btn-botton"
									type='primary'
									htmlType="submit"
									onClick={this.save.bind(this, '08')}
									disabled={this.state.clickFlag ? true : (this.state.disabledAll || ((this.state.statusCode != '01') && (this.state.statusCode != '03')))}
								>{this.display('OperationApplycancel')}
								</Button>
							</div>
							<div style={{ margin: '0 8px', display: this.state.locType == 'OP' ? 'none' : '' }}>
								<Button
									className="btn-botton"
									style={{ marginLeft: '-4px' }}
									type='primary'
									htmlType="submit"
									onClick={this.save.bind(this, '09')}
									disabled={this.state.clickFlag ? true : this.state.disabledAll || (this.state.statusCode && this.state.statusCode != '08' && this.state.statusCode != '09')}
								>{this.display('OperationApplysave')}
								</Button>
							</div>
							<div style={{ margin: '0 8px 0 0', display: this.state.locType == 'OP' ? 'none' : '' }}>
								<Button
									className="btn-botton"
									type='primary'
									htmlType="submit"
									onClick={this.save.bind(this, '01')}
									icon='send'
									disabled={this.state.clickFlag ? true : this.state.disabledAll || (this.state.statusCode != '08' && this.state.statusCode != '09')}
								>{this.display('OperationApplyapply')}
								</Button>
							</div>
							<div style={{ margin: '0 8px 0 0', display: this.state.locType == 'OP' ? '' : 'none' }}>
								<Button
									className="btn-botton"
									type='primary'
									htmlType="submit"
									onClick={this.save.bind(this, '')}
								>修改
								</Button>
							</div>
							<Button ghost type="primary" onClick={this.handleHistoricalConfig}>选择配置模板</Button>
						</div>
					</div>
					{/**列input框新表格弹框 */}
					<div
						tabIndex={1}
						onKeyDown={this.handleOnKeydown.bind(this)}
						style={{ outline: 'none' }}
					>
						<ShowCommonTableModal onClickRowPublic={this.onClickRowPublic}
							handleFocus={this.handleFocus.bind(this)}
							setRowClassNamePublic={this.setRowClassNamePublic}
							param={param}
							onRef={this.onRef}
							id="gundong"
							search={this.state.search}
							compilePage={this.changePageSize.bind(this)}>
						</ShowCommonTableModal>
					</div>
					<PublicModalQueryTable
						title="历史配置"
						queryCode="04160036"
						componentName="OperationApplyHistoryConfig"
						onRef={ref => this.historyConfigRef = ref}
						handleOk={this.handleHistoryConfigOk}
					/>
				</div>
			)
		}
	}
)

export default OperationApply;